home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-03 / dwarcs11.zip / DWARCS.DOC < prev    next >
Text File  |  1993-02-23  |  9KB  |  213 lines

  1.                               DWArcs version 1.1
  2.                           Written by James R. Davis
  3.                    (C) Copyright 1993 - All Rights Reserved
  4.  
  5. While writing a program one day I came across a need for reading in filenames
  6. contained within archives.  This PowerBASIC library is something I whipped up
  7. in order to fulfill that need.  It contains only 4 routines and one variable
  8. but I'm sure you'll find this to be a very helpful addition to your PowerBASIC
  9. toolbox.
  10.  
  11.                                 PRELIMINARIES
  12.                                 -------------
  13.  
  14. You should find the following files in this archive:
  15.  
  16.              DWADEMO.BAS  - Demo source for using the library
  17.              DWARCS.DOC   - This doc file
  18.              DWARCSRC.EXE - For registered users
  19.              DWARCS2F.PBU - PBU for PB 2.10f
  20.              DWARCS3A.PBU - PBU for PB 3.00a
  21.              DWARE.DOC    - Complete list of DavisWARE available
  22.              FILE_ID.DIZ  - Description file for BBS's
  23.              ORDER.FRM    - Form for registering this program
  24.  
  25. If any of these files are missing, you can call my BBS the Programmer's
  26. Mega-Source at (516) 737-4637 and get the latest version.
  27.  
  28. At this time, this library handles the following archive formats:
  29.  
  30.                       ARC - PKARC up to version 5.10
  31.                       ARJ - ARJ up to version 2.39a BETA
  32.                       LZH - LHARC up to version 1.13c
  33.                       PAK - PKPAK up to version 2.51
  34.                       ZIP - PKZIP up to version 2.04G
  35.                       ZOO - ZOO up to version 2.1
  36.  
  37. If you find an archive format not supported here, let me know and I'll try to
  38. work it into the next version.
  39.  
  40. The following PBU's included with this program are for the different
  41. PowerBASIC versions:
  42.  
  43.                 DWARCS2F.PBU - For version 2.10f of PowerBASIC
  44.                 DWARCS3A.PBU - For version 3.00a of PowerBASIC
  45.  
  46. A version for 3.00b of PowerBASIC will be released soon.
  47.  
  48. Now on to the library.  See the demo program for actual program use and for
  49. more extensive examples.  There are 3 Functions, 1 Subroutine and 1 Variable
  50. that this library can handle.  Here's the descriptions:
  51.  
  52.  
  53.                                  DESCRIPTIONS
  54.                                  ------------
  55.  
  56. -------------------------------------------------------------------------------
  57.  Net%   VARIABLE  Set to non-zero if working on a remote terminal of a network
  58. -------------------------------------------------------------------------------
  59. This variable when set to a non-zero number, will tell the rest of the
  60. functions that the program is running on a remote terminal of a network.
  61. This is accomplished simply by removing the drive letter from file names
  62. specified.  When you set this variable, routines within the library will
  63. automatically do this for you.
  64.  
  65. Syntax:  Net% = -1
  66.  
  67. Example:
  68.  
  69.   PRINT "Is this program running on a remote terminal of a network? (Y/n): ";
  70.   A$ = INPUT$(1)
  71.   A$ = UCASE$(A$)
  72.   IF A$ = "N" THEN
  73.     Net% = 0
  74.     PRINT "N"
  75.   ELSE
  76.     Net% = -1
  77.     PRINT "Y"
  78.   END IF
  79.  
  80. -------------------------------------------------------------------------------
  81.  ArcFiles%()  FUNCTION  Returns number of files in an archive
  82. -------------------------------------------------------------------------------
  83. This function will return the total number of files within the archive name
  84. passed to it in File$.  Will return -1 if archive file does not exist, -2 if
  85. file is not an archive supported.
  86.  
  87. Syntax:  A% = ArcFiles%(File$)
  88.  
  89.          Where File$ = The file name with or without drive and path of the
  90.                        archive you wish to get the information from.
  91.  
  92. Example:
  93.  
  94.   A$ = "C:\TEMP\TEST.ZIP"
  95.   A% = ArcFiles%(A$)
  96.   IF A% = -1 THEN
  97.     PRINT A$;" does not exist!"
  98.   ELSEIF A% = -2 THEN
  99.     PRINT A$;" is not supported!"
  100.   ELSE
  101.     PRINT "There are ";LTRIM$(STR$(A%));" file(s) in ";A$
  102.   END IF
  103.  
  104. -------------------------------------------------------------------------------
  105.  ArcDir$()  FUNCTION  Returns first/subsequent filenames in archive
  106. -------------------------------------------------------------------------------
  107. This function acts like DIR$("*.*") in that it returns a the first filename
  108. within the archive specified in File$.  Any subsequent calls to this routine
  109. will return the next filename found in the archive.  ArcDir$ will return a
  110. null string if the archive does not exist, is not a supported archive or the
  111. last filename has been found in the archive.
  112.  
  113. Syntax:  A$ = ArcDir$(File$)
  114.  
  115.          Where File$ = Is the name with or without drive and path of the
  116.                        archive in which to use.
  117.  
  118. Example:
  119.  
  120.   F$ = "C:\TEMP\TEST.ZIP"
  121.   A$ = ArcDir$(F$)
  122.   IF A$ = "" THEN
  123.     PRINT F$;" does not exist or is not supported!"
  124.   END IF
  125.   WHILE A$ <> ""
  126.     PRINT A$
  127.     A$ = ArcDir$(F$)
  128.   WEND
  129.  
  130. -------------------------------------------------------------------------------
  131.  ArcInfo()  SUBROUTINE  Returns specific data about file within an archive
  132. -------------------------------------------------------------------------------
  133. This subroutine will search an archive for filename.  If found the file's
  134. date, time, size and compressed size will be returned.  Otherwise, if not found, null
  135. strings will be returned.
  136.  
  137. Syntax:  CALL ArcInfo(File$,Arc$,FileDate$,FileTime$,FileSize$,CompSize$)
  138.  
  139.          Where File$     = The archive filename to use, can contain a drive
  140.                            and/or path.  If filename does not exist or is not
  141.                            supported, File$ will be set to a null string.
  142.                Arc$      = The file within the archive to get information for.
  143.                            If Arc$ is not found, all stirngs will be set to
  144.                            a null string. (eg: A$ = "")  Must not contain a
  145.                            drive or pathname.
  146.                FileDate$ = The file date of Arc$ in MM-DD-YY format
  147.                FileTime$ = The file time of Arc$ in HH:MMa format
  148.                FileSize$ = The actual file size before compression
  149.                CompSize$ = The file size after compression
  150.  
  151.          Note: The file sizes are contained in strings to avoid having to
  152.                assign a specific variable type to the function.  Use VAL() to
  153.                get the sizes into a variable after calling the subroutine.
  154.  
  155. Example:
  156.  
  157.   F$ = "C:\TEMP\TEST.ZIP"
  158.   A$ = "TEST.DOC"
  159.   FF$ = F$
  160.   CALL ArcInfo(FF$, A$, FD$, FT$, FS$, CS$)
  161.   IF FF$ = "" THEN
  162.     PRINT F$; " does not exist or is not supported!"
  163.     END
  164.   END IF
  165.   IF FD$ = "" THEN
  166.     PRINT A$; " does not exist in "; F$
  167.   ELSE
  168.     PRINT A$, FS$, CS$, FD$; " "; FT$; " ";
  169.     PRINT USING$("###%", 100 - INT((100 / VAL(FS$)) * VAL(CS$)))
  170.   END IF
  171.  
  172.  
  173. -------------------------------------------------------------------------------
  174.  SearchArc%()  FUNCTION  Will search an archive for a specified filename
  175. -------------------------------------------------------------------------------
  176. This function will allow you to search an archive for a specified filename.
  177. If the filename was found in the archive, this function will return a non-zero
  178. number, or 0 if the filename was not found.  This function does not check to
  179. see if the archive exists.
  180.  
  181. Syntax:  A% = SearchArc%(File$, Search$)
  182.          Where File$   = The filename and/or drive and path fo the archive to
  183.                          search.  This function does not check to see if this
  184.                          file exists.
  185.                Search$ = Is the filename to search for within the archive.  If
  186.                          it is found, a non-zero number is returned.  If not,
  187.                          0 is returned.
  188.  
  189. Example:
  190.  
  191.   F$ = "C:\TEMP\TEST.ZIP"
  192.   A$ = "FILE_ID.DIZ"
  193.   A% = SearchArc%(F$, A$)
  194.   IF A% THEN
  195.     PRINT A$; " exists within ";F$
  196.   ELSE
  197.     PRINT A$; " does not exist within "; F$
  198.   END IF
  199.  
  200.  
  201.                                  REGISTRATION
  202.                                  ------------
  203.  
  204. Well, that about does it for the library... pretty simple right?  Thought so.
  205. If you find this library of use, and would like the source code, the
  206. registration fee for this program is $15.  Use the ORDER.FRM included with
  207. this library to register this library for a license to use it in your
  208. programs.  Have fun and keep on programming!
  209.  
  210.                        -=> James "The Garf!" Davis! <=-
  211.  
  212.  
  213.